<div class="panel panel-default">{{$project := .project}}{{$username := .username}}
    <div class="panel-body">
        <p><strong>【{{$project.name}}】 项目发布历史</strong></p>
    </div>
    <div class="table-responsive">
        <table class="table table-bordered">
            <thead>
            <tr>
                <th class="w8p">发布人</th>
                <th>备注</th>
                <th class="w8p">类型</th>
                <th class="w15p">创建时间</th>
                <th class="w8p">结果</th>
                <th class="w10p">操作</th>
            </tr>
            </thead>
            <tbody>
            {{range $task := .tasks}}
                <tr>
                    <td class="center">{{$task.username}}</td>
                    <td>{{$task.comment}}</td>
                    <td class="center">
                        {{if eq $task.sha1_id ""}}
                            <label class="text-info">发布</label>
                        {{else}}
                            <label><a data-toggle="collapse" data-target="#rollback_{{$task.task_id}}"
                                      class="text-danger"><i class="glyphicon glyphicon-hand-down"></i>回滚</a></label>
                        {{end}}
                    </td>
                    <td class="center">{{dateFormat $task.create_time "Y-m-d H:i:s"}}</td>
                    <td class="center">
                        {{if eq $task.status "1"}}
                            <span class="label label-success">成功</span>
                        {{else if eq $task.status "2"}}
                            <img src='/static/style/layui/layer/theme/default/loading-2.gif' style='max-width:17px;'>
                        {{else}}
                            <span class="label label-danger">失败</span>
                        {{end}}
                    </td>
                    <td class="center">
                        <a name="watch" href="/publish/taskLog?task_id={{$task.task_id}}"><i
                                    class="glyphicon glyphicon-eye-open"></i>节点状态</a>
                    </td>
                </tr>
                <tr class="collapse" id="rollback_{{$task.task_id}}">
                    <td colspan="6" class="center">
                        <strong class="text-danger">sha1_id: {{$task.sha1_id}}</strong>
                    </td>
                </tr>
            {{end}}
            </tbody>
        </table>
    </div>
    <div class="panel-footer">
        {{template "paginator/default.html" .}}
    </div>
</div>